package com.cloud.springbootcloud.controller;

import com.cloud.springbootcloud.pojo.Order;
import com.cloud.springbootcloud.service.OrderService;
import com.cloud.springbootcloud.utils.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;
    @GetMapping("/{id}")
    @ResponseBody
    public JSONResult selectOrderById(@PathVariable("id") Integer id){
        return JSONResult.ok(orderService.selectOrderById(id));
    }
    @GetMapping("/hello")
    @ResponseBody
    public Order hello(){
        return orderService.selectOrderById(1);
    }
}
